load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "workload",
    srcs = [
        "connection.go",
        "csv.go",
        "driver.go",
        "pgx_helpers.go",
        "random.go",
        "round_robin.go",
        "sql_runner.go",
        "stats.go",
        "workload.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/workload",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/col/coldata",
        "//pkg/col/typeconv",
        "//pkg/sql/sem/tree",
        "//pkg/sql/types",
        "//pkg/util/bufalloc",
        "//pkg/util/encoding/csv",
        "//pkg/util/log",
        "//pkg/util/randutil",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",
        "//pkg/workload/histogram",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_jackc_pgx_v5//:pgx",
        "@com_github_jackc_pgx_v5//pgconn",
        "@com_github_jackc_pgx_v5//pgxpool",
        "@com_github_lib_pq//:pq",
        "@com_github_rs_dnscache//:dnscache",
        "@com_github_spf13_pflag//:pflag",
        "@org_golang_x_sync//errgroup",
    ],
)

go_test(
    name = "workload_test",
    size = "small",
    srcs = [
        "bench_test.go",
        "csv_test.go",
        "main_test.go",
        "pgx_helpers_test.go",
        "stats_test.go",
        "workload_test.go",
    ],
    embed = [":workload"],
    deps = [
        "//pkg/col/coldata",
        "//pkg/security/securityassets",
        "//pkg/security/securitytest",
        "//pkg/server",
        "//pkg/sql/types",
        "//pkg/testutils",
        "//pkg/testutils/serverutils",
        "//pkg/testutils/skip",
        "//pkg/testutils/testcluster",
        "//pkg/util/bufalloc",
        "//pkg/util/httputil",
        "//pkg/util/leaktest",
        "//pkg/util/randutil",
        "//pkg/workload/bank",
        "//pkg/workload/tpcc",
        "//pkg/workload/tpch",
    ],
)
